package com.itheima.service.impl;

import com.alibaba.druid.pool.DruidDataSource;
import com.itheima.dao.BookDao;
import com.itheima.dao.impl.BookDaoImpl;
import com.itheima.dao.impl.UserDaoImpl;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.sql.DataSource;

@Component
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDaoImpl userDao;


    @Autowired
    private BookDaoImpl bookDao;

    public void save() {
        System.out.println("user service running...");
        bookDao.save();
    }

    @Autowired
    private DataSource dataSource;
    @PostConstruct
    public void init(){
        System.out.println("user servier init...");
        System.out.println(dataSource.toString());
    }
    @PreDestroy
    public void destroy(){
        System.out.println("user servier destroy...");
    }

}
/**/